package org.testing.model.questions;

import org.testing.model.InOutManager;
import org.testing.model.correctQuestionAnswers.CorrectAnswer;
import org.testing.model.correctQuestionAnswers.CorrectRangeAnswer;
import org.testing.model.results.DoubleResult;
import org.testing.model.results.Result;
import org.testing.model.userAnswers.SimpleUserAnswer;
import org.testing.model.userAnswers.UserAnswer;
import org.testing.model.variants.Variant;

public class RangeAnswerQuestion implements Question {
	private String helpText = "Put the value you think its correct\n";
	private String bodyText;
	private CorrectAnswer correctAnswer;
	
	public RangeAnswerQuestion(String bodyText, CorrectRangeAnswer correctAnswer) {
		this.bodyText = bodyText;
		this.correctAnswer = correctAnswer;
		
	}
	@Override
	public String getHelp() {
		return helpText;
	}

	@Override
	public UserAnswer readUserAnswer(InOutManager inOut) {
		return new SimpleUserAnswer(inOut.inPutLine());
	}

	@Override
	public Result check(UserAnswer answer) {
		return new DoubleResult(this.correctAnswer.equals(answer));
	}

	//No variants for this type of question
	@Override
	public void addVariant(Variant variant) {
		//stub
		
	}
	
	public String toString() {
		return bodyText;
	}

}
